package com.hospital.phyexam.impl;

import com.alibaba.fastjson.JSON;
import com.hospital.phyexam.dao.PhyexamBatchMapper;
import com.hospital.phyexam.entity.PhyexamBatch;
import com.hospital.phyexam.service.BatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: Hospital
 * @description: 批次
 * @author: 杨曼珍
 * @create: 2019-01-12 20:44
 **/
@Service
public class BatchServiceImpl implements BatchService {
    @Autowired
    PhyexamBatchMapper batchMapper;

    @Override
    public String getAllBatch(){
        List<PhyexamBatch>phyexamBatches=batchMapper.selectAll();
        List<Map<String,String>>resaultmap=new ArrayList<>();
        for (PhyexamBatch phyexamBatch:phyexamBatches){
            Map<String,String>map=new HashMap<>();
            map.put("PhyExmBatchName",phyexamBatch.getPhyExmBatchName());
            map.put("id",phyexamBatch.getId().toString());
            resaultmap.add(map);
        }
        return JSON.toJSONString(resaultmap);
    }
}
